<template>
  <!-- 下拉组件 -->
  <select-table
    :columns="preparerColumns"
    :config="config"
    :tableData="tableData"
    :total="total"
    @selectChange="selectChange"
    @handleCurrentChange="handleCurrentChange"
  ></select-table>
</template>

<script>
import axios from "axios";
import selectTable from "@/components/selectTable/index.vue";
export default {
  components: { selectTable },
  data() {
    return {
      preparerColumns: [
        {
          prop: "staffName",
          label: "制单人名称",
        },
        {
          prop: "staffCode",
          label: "制单人编号",
        },
      ],
      config: {
        label: 'staffName'
      },
      tableData: [],
      total: 0,
      pageIndex: 1,
      pageSize: 2,
      dataForm: {
        staffCode: "",
        staffName: "",
      },
    };
  },
  created() {
    this.getDataList();
  },
  methods: {
    // 修改选中
    selectChange(arr) {
      console.log(arr, "选中");
    },
    // 模糊搜索
    inputChange(val, prop) {
      this.dataForm[prop] = val;
    },
    // 获取表格数据
    getDataList() {
      axios.post("/staff/list").then((res) => {
        this.tableData = res.data.rows;
        this.total = res.data.total;
      });
    },
    handleCurrentChange(val) {
      this.pageIndex = val;
      this.getDataList();
    },
  },
};
</script>

<style lang="scss" scoped>
.staff-selct-style {
}
</style>